package com.ysg.widget.table;

import android.content.Context;
import android.util.AttributeSet;
import android.widget.HorizontalScrollView;

/**
 * 控制联动的HorizontalScrollView
 */
public class TableContentHorizontalScrollView extends HorizontalScrollView {

    public TableContentHorizontalScrollView(Context context) {
        super(context);
    }

    public TableContentHorizontalScrollView(Context context, AttributeSet attrs) {
        super(context, attrs);
    }

    public TableContentHorizontalScrollView(Context context, AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
    }

    @Override
    protected void onScrollChanged(int l, int t, int oldl, int oldt) {
        super.onScrollChanged(l, t, oldl, oldt);
        if (listener != null){
            listener.onScroll(l, t);
        }
    }

    private LinkScrollChangeListener listener;
    public void setLinkScrollChangeListener(LinkScrollChangeListener listener) {
        this.listener = listener;
    }
    public interface LinkScrollChangeListener {
        void onScroll(int l, int t);
    }
}
